import axios from "axios";
import QS from 'qs';
// 发票
export function invoice(data) {
	let data1 = {
		inv_type: data.inv_type,
		inv_content: data.inv_content,
		inv_state: data.inv_state,
		inv_title: data.inv_title,
		inv_company: data.inv_company,
		inv_code: data.inv_code,
		inv_reg_addr: data.inv_reg_addr,
		inv_reg_phone: data.inv_reg_phone,
		inv_reg_bname: data.inv_reg_bname,
		inv_reg_baccount: data.inv_reg_baccount,
		key: data.key
	}
    return axios({
        url: '/mobile/index.php?app=test_member_buy&way=invoice',
        method: 'post',
        data: QS.stringify(data1)
    })
}
// 微信登录
export function wxLogin(data) {
    return axios({
        url: '/mobile/index.php',
        method: 'get',
        params: {
            app:data.app,
            way:data.way,
            source: data.source
        }
    })
}
// 地区接口
export function areaList(data) {
    return axios({
        url: '/mobile/index.php?app=area&way=area_list',
        method: 'get',
        params: {
            area_id: data.area_id
        }
    })
}
// 土壤类型列表
export function soilType() {
    return axios({
        url: '/mobile/index.php?app=test_soil&way=soil',
        method: 'get',
        params: {
        }
    })
}
// 地质类型列表
export function textureType() {
    return axios({
        url: '/mobile/index.php?app=test_soil&way=texture',
        method: 'get',
        params: {
        }
    })
}
// 快递列表
export function expressList() {
    return axios({
        url: '/mobile/index.php?app=test_member_buy&way=express_list&key=aa3ab733b690faa86c271f6bbd91db41',
        method: 'get',
        params: {
        }
    })
}
// 修改订单快递
export function editExpress(data) {
	let data1 = {
		key: data.key,
		order_id: data.order_id,
		express_id: data.express_id,
		shipping_code: data.shipping_code,
	}
    return axios({
        url: '/mobile/index.php?app=test_member_buy&way=express',
        method: 'post',
        data: QS.stringify(data1)
    })
}
// 订单支付
export function orderPay(data) {
    let data1 = {
        key: data.key,
        area_id: data.area_id,
        city_id: data.city_id,
        sampling_time: data.sampling_time,
        area_info: data.area_info,
        address: data.address,
        soil_id: data.soil_id,
        texture_id: data.texture_id,
        plant_area:data.plant_area,
        previous_crop: data.previous_crop,
        output: data.output,
        season_crop: data.season_crop,
        target_output: data.target_output,
        phone: data.phone,
        name: data.name,
        purpose: data.purpose,
        invoice_id: data.invoice_id,
        proof_path: data.proof_path,
        sample_number: data.sample_number,
        longitude:data.longitude,
        latitude:data.latitude,
        payment_amount_type: data.payment_amount_type
    }
    return axios({
        url: '/mobile/index.php?app=test_member_buy&way=buy_step',
        method: 'post',
        data: QS.stringify(data1)
    })
}
// 0元购买
export function orderPayZero(data) {
    let data1 = {
        key: data.key,
        area_id: data.area_id,
        city_id: data.city_id,
        sampling_time: data.sampling_time,
        area_info: data.area_info,
        address: data.address,
        soil_id: data.soil_id,
        texture_id: data.texture_id,
        plant_area:data.plant_area,
        previous_crop: data.previous_crop,
        output: data.output,
        season_crop: data.season_crop,
        target_output: data.target_output,
        phone: data.phone,
        name: data.name,
        purpose: data.purpose,
        invoice_id: data.invoice_id,
        proof_path: data.proof_path,
        sample_number: data.sample_number,
        longitude:data.longitude,
        latitude:data.latitude,
        payment_amount_type: data.payment_amount_type
    }
    return axios({
        url: '/mobile/index.php?app=test_member_buy&way=buy_step_zero',
        method: 'post',
        data: QS.stringify(data1)
    })
}
// 取消订单
export function orderCancel(data) {
    let data1 = {
        order_id: data.order_id,
        key: data.key,
    }
    return axios({
        url: '/mobile/index.php?app=test_member_buy&way=order_cancel',
        method: 'post',
        data: QS.stringify(data1)
    })
}
// 订单列表
export function orderList(data) {
    let data1 = {
        order_state: data.order_state,
        key: data.key,
        curpage: data.curpage
    }
    return axios({
        url: '/mobile/index.php?app=test_member_buy&way=order_list&',
        method: 'post',
        data: QS.stringify(data1)
    })
}
// 上传凭证
export function uploadProof(data) {
    return axios({
        url: '/mobile/index.php?app=test_soil&way=upload_proof',
        method: 'post',
        data: data
    })
}
// 重新支付
export function orderBuyAgain(data) {
    let data1 = {
        order_id: data.order_id,
        key: data.key,
    }
    return axios({
        url: '/mobile/index.php?app=test_member_buy&way=buy_anew',
        method: 'post',
        data: QS.stringify(data1)
    })
}
// 订单详情
export function orderDetail(data) {
    return axios({
        url: '/mobile/index.php?app=test_member_buy&way=order_info',
        method: 'get',
        params: {
            order_id: data.order_id,
            key: data.key,
        }
    })
}
// 送样信息
export function sampleSendingInformation() {
    return axios({
        url: '/mobile/index.php?app=test_soil&way=sampling_info',
        method: 'get',
        params: {}
    })
}
// 订单状态数量
export function ordersNumber(data) {
    return axios({
        url: '/mobile/index.php?app=test_member_buy&way=order_status_count',
        method: 'get',
        params: {
            key: data.key
        }
    })
}
// 检测项目查询
export function testItems(data) {
    return axios({
        url: '/mobile/index.php?app=test_soil&way=test_items',
        method: 'get',
        params: {
            payment_amount_type: data.payment_amount_type
        }
    })
}